<script type="text/javascript" src="javascript/ajax/prototype.js"></script>
<script type="text/javascript" src="javascript/ajax/scriptaculous.js" ></script>
<script type="text/javascript" src="javascript/ajax/effects.js" ></script>
<script language="javascript" src="modules/iCarrent/pnajax/ajax_topic.js"></script>

<script type="text/javascript">
  function enable_text(status){
    status=!status;
    document.f1.other_text.disabled = status;
  }
</script>


<!--[ include file="admin_header_menu.htm" ]-->
<div class="admin_content">
<a class="button" href="#"><!--[pnml name='เพิ่ม / แก้ไข รถเช่า']--></a>

<!-- new detail -->
<form enctype="multipart/form-data" action="<!--[pnmodurl modname='iCarrent' type='adminform' func='submit' ctrl='Topics']-->" method="post">
<input type="hidden" name="form[id]" value="<!--[$_GET.id]-->" />
<!--[if !$form.shop_id]-->
<input type="hidden" name="form[shop_id]" value="<!--[$_GET.shop_id]-->" />
<input type="hidden" name="forward[shop_id]" value="<!--[$_GET.shop_id]-->" />
<!--[else]-->
<input type="hidden" name="form[shop_id]" value="<!--[$form.shop_id]-->" />
<input type="hidden" name="forward[shop_id]" value="<!--[$form.shop_id]-->" />
<!--[/if]-->
<input type="hidden" name="forward[func]" value="list" />
<input type="hidden" name="forward[ctrl]" value="Topics" />

<table class="adminform">
  <tr>
    <td><label><!--[pnml name='CATEGORY']--> </label></td>
    <td>
            <!--[selector_object_array_ex modname="iCarrent"
                    class="Category"
                    field="id"
                    displayField="name"
                    name="form[category_id]"
                    selectedValue=$form.category_id
                    onclick="getSubCetegory()"
                    style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(255, 255, 255);"
                    size="8"
                    sort="cty_name"
            ]-->
        <span id="subcat">
              <!--[if $form.category_id]-->
                <!--[selector_object_array_ex modname="iCarrent"
                        class="SubCategory"
                        field="id"
                        displayField="name"
                        name="form[subcategory_id]"
                        selectedValue=$form.subcategory_id
                        onclick="getBrand()"
                        queryField = scy_category_id
                        queryValue = $form.category_id
                        style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(255, 255, 255);"
                        size="8"
                        sort="scy_name"
                ]-->
              <!--[else]-->
                <select id="form_sub_category_id_" style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(255, 255, 255);" size="8">
                </select>
              <!--[/if]-->
        </span>
        <span id="brand">
              <!--[if $form.subcategory_id]-->
                <!--[if $form.brand_id == "99999"]-->
                  <select name="form[brand_id]" id="form_brand_id_"
                          style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(220, 220, 220);"
                          size="8"
                  >
                    <option value="99999" selected></option>
                    <option value="99999"></option>
                    <option value="99999"></option>
                    <option value="99999">Empty category</option>
                    <option value="99999">Please select new </option>
                  </select>
                <!--[else]-->
                  <!--[selector_object_array_ex modname="iCarrent"
                          class="SubCategoryBrand"
                          field="brand_id"
                          displayField="brand_name"
                          name="form[brand_id]"
                          selectedValue=$form.brand_id
                          onclick="getSubcategoryModel()"
                          queryField = sbra_subcategory_id
                          queryValue = $form.subcategory_id
                          style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(255, 255, 255);"
                          size="8"
                          sort="bra_name"
                  ]-->
                <!--[/if]-->
              <!--[else]-->
                <select id="form_brand_id_" style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(255, 255, 255);" size="8">
                </select>
              <!--[/if]-->
        </span>
        <span id="model">
              <!--[if $form.subcategory_id]-->
                <!--[if $form.brand_id == "99999"]-->
                  <select name="form[model_id]" id="form_model_id_"
                          style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(220, 220, 220);"
                          size="8"
                  >
                    <option value="99999" selected></option>
                    <option value="99999"></option>
                    <option value="99999"></option>
                    <option value="99999">Empty category</option>
                    <option value="99999">Please select new </option>
                  </select>
                <!--[else]-->
                  <!--[if $form.model_id == "99999"]-->
                    <select name="form[model_id]" id="form_model_id_"
                            style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(220, 220, 220);"
                            size="8"
                    >
                      <option value="99999" selected></option>
                      <option value="99999"></option>
                      <option value="99999"></option>
                      <option value="99999">Empty category</option>
                      <option value="99999">Please select new </option>
                    </select>
                  <!--[else]-->

                    <!--[selector_object_array_ex modname="iCarrent"
                            class="SubcategoryModel"
                            field="model_id"
                            displayField="model_name"
                            queryField1 = smod_category_id
                            queryValue1 = $form.category_id
                            queryField2 = smod_subcategory_id
                            queryValue2 = $form.subcategory_id
                            queryField3 = smod_brand_id
                            queryValue3 = $form.brand_id
                            selectedValue=$form.model_id
                            style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(255, 255, 255);"
                            size="8"
                            sort="model_name"
                    ]-->
                  <!--[/if]-->
                <!--[/if]-->
              <!--[else]-->
                <select id="form_model_id_" style="width: 120px; height: 150px; background: none repeat scroll 0% 0% rgb(255, 255, 255);" size="8">
                </select>
              <!--[/if]-->
            </span>
    </td>
  </tr>
  </tr>
    <tr>
    <td><label>คุณสมบัติ :</label></td>
    <td>
      <!--[if $smarty.get.id]-->
        <span id="carproperty">
          <!--[get_all_carproperty_by_id category_id=$form.category_id subcategory_id=$form.subcategory_id brand_id=$form.brand_id model_id=$form.model_id]-->
          <!--[if $form.carproperty_id != "N;" || $form.subcategory_id]-->
            <!--[if $carPropertyArray]-->
              <!--[foreach from=$carPropertyArray item=item_all_carprop key=key name=foo]-->
                <!--[assign var='compare' value='false']-->
                <!--[foreach from=$form.carproperty_id|unserialize item=item_carprop key=select_key]-->
                   <!--[if $item_all_carprop.id eq $item_carprop]-->
                    <!--[assign var='compare' value='true']-->
                      <!--[if (($smarty.foreach.foo.index+1) %4) == 0]-->
                        <span id=123A style="float: left; text-align: left; width: 25%;">
                          <input name="form[carproperty_id][]" value="<!--[$item_all_carprop.id]-->" type="checkbox" checked>  <!--[$item_all_carprop.name]-->
                        </span>
                        <div style="clear:left"></div>
                      <!--[else]-->
                        <span id=123A style="float: left; text-align: left; width: 25%;">
                          <input name="form[carproperty_id][]" value="<!--[$item_all_carprop.id]-->" type="checkbox" checked>  <!--[$item_all_carprop.name]-->
                        </span>
                    <!--[/if]-->
                  <!--[/if]-->
                <!--[/foreach]-->
                   <!--[if $compare eq 'false']-->
                      <!--[if (($smarty.foreach.foo.index+1) %4) == 0]-->
                        <span id=123A style="float: left; text-align: left; width: 25%;">
                          <input name="form[carproperty_id][]" value="<!--[$item_all_carprop.id]-->" type="checkbox" >  <!--[$item_all_carprop.name]-->
                        </span>
                        <div style="clear:left"></div>
                      <!--[else]-->
                        <span id=123A style="float: left; text-align: left; width: 25%;">
                          <input name="form[carproperty_id][]" value="<!--[$item_all_carprop.id]-->" type="checkbox" >  <!--[$item_all_carprop.name]-->
                        </span>
                    <!--[/if]-->
                  <!--[/if]-->
              <!--[/foreach]-->
            <!--[else]-->
              ไม่มี<span name="form[carproperty_id][]" value=""></span>
            <!--[/if]-->
          <!--[else]-->
            ไม่มี<span name="form[carproperty_id][]" value=""></span>
          <!--[/if]-->
        </span>
        <!-- $form.carproperty_id|unserialize|var_dump -->
      <!--[else]-->
        <span id="carproperty"></span>
      <!--[/if]-->
    </td>
  </tr>
  <tr>
    <td><label>ค่าเช่ารายวัน : </label></td>
    <td><input type="text" name="form[price_day]" value="<!--[$form.price_day]-->" title="Please name" class="innova_input" /> &nbsp;บาท</td>
  </tr>
  <tr>
    <td><label>ค่าเช่ารายสัปดาห์ : </label></td>
    <td><input type="text" name="form[price_week]" value="<!--[$form.price_week]-->" title="Please name" class="innova_input"  /> &nbsp;บาท</td>
  </tr>
  <tr>
    <td><label>ค่าเช่ารายเดือน : </label></td>
    <td><input type="text" name="form[price_month]" value="<!--[$form.price_month]-->" title="Please name" class="innova_input" /> &nbsp;บาท</td>
  </tr>
  <tr>
    <td><label>ค่าเช่ารายปี : </label></td>
    <td><input type="text" name="form[price_year]" value="<!--[$form.price_year]-->" title="Please name" class="innova_input"  /> &nbsp;บาท</td>
  </tr>
  <tr>
    <td><label>ค่า Commission : </label></td>ึ
    <td><input type="text" name="form[commission]" value="<!--[$form.commission]-->" title="Please name" class="innova_input"  /> &nbsp;บาท</td>
  </tr>
  <tr>
    <td><label>ส่วนลด : </label></td>
    <td><input type="text" name="form[discount]" value="<!--[$form.discount]-->" title="Please name" class="innova_input"  /> &nbsp;บาท</td>
  </tr>
  <tr>
    <td><label>รายละเอียด : </label></td>
    <td>
      <textarea rows="10" cols="40" name="form[detail]">
        <!--[$form.detail]-->
      </textarea>
    </td>
  </tr>
</table>
	<button name="button_submit" value='Submit' type="submit" class="button save"><!--[pnml name='_ICARRENT_GLOBAL_OK']--></button>
	<button name="button_cancel" value='Cancel' type="submit" class="button flag"><!--[pnml name='_ICARRENT_GLOBAL_CANCEL']--></button>
</form>
</div>